import { createRouter, createWebHistory } from 'vue-router'
import HomePage from '../pages/HomePage.vue'
import UserLoginPage from '../pages/user/UserLoginPage.vue'
import UserRegisterPage from '../pages/user/UserRegisterPage.vue'
import UserManagePage from '../pages/admin/UserManagePage.vue'
import AddPicturePage from '../pages/AddPicturePage.vue'
import PictureManagePage from '@/pages/admin/PictureManagePage.vue'
import NoAuthPage from '../pages/NoAuthPage.vue'
import ACCESS_ENUM from '../access/accessEnum'
import { HomeOutlined, ContactsOutlined, CloudOutlined, FileImageOutlined, FileOutlined, CloudServerOutlined, FolderOpenOutlined  } from '@ant-design/icons-vue'
import PictureDetailPage from '@/pages/PictureDetailPage.vue'
import AddPictureBatchPage from '@/pages/admin/AddPictureBatchPage.vue'
import SpaceManagePage from '@/pages/admin/SpaceManagePage.vue'
import AddSpacePage from '@/pages/AddSpacePage.vue'
import MySpacePage from '@/pages/MySpacePage.vue'
import SpaceDetailPage from '@/pages/SpaceDetailPage.vue'
import UserThirdPartyLoginPage from '@/pages/user/UserThirdPartyLoginPage.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: '主页',
      component: HomePage,
      meta: {
        icon: HomeOutlined
      }
    },
    {
      path: '/user/login',
      name: '用户登录',
      component: UserLoginPage,
      meta: {
        hideInMenu: true
      }
    },
    {
      path: '/user/thirdPartyLogin',
      name: '用户三方登录',
      component: UserThirdPartyLoginPage,
      meta: {
        hideInMenu: true
      }
    },
    {
      path: '/user/register',
      name: '用户注册',
      component: UserRegisterPage,
      meta: {
        hideInMenu: true
      }
    },
    {
      path: '/admin/userManage',
      name: '用户管理',
      component: UserManagePage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
        icon: ContactsOutlined
      }
    },
    {
      path: '/noAuth',
      name: '用户没有权限访问',
      component: NoAuthPage,
      meta: {
        hideInMenu: true
      }
    },
    {
      path: '/addPicture',
      name: '创建图片',
      component: AddPicturePage,
      meta: {
        access: ACCESS_ENUM.USER,
        icon: FileOutlined
      },
    },
    {
      path: '/admin/pictureManage',
      name: '图片管理',
      component: PictureManagePage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
        icon: FileImageOutlined
      }
    },
    {
      path: '/picture/:id',
      name: '图片详情',
      component: PictureDetailPage,
      props: true,
      meta: {
        hideInMenu: true
      }
    },
    {
      path: '/addPicture/batch',
      name: '批量创建图片',
      component: AddPictureBatchPage,
      meta: {
        hideInMenu: true
      }
    },
    {
      path: '/admin/spaceManage',
      name: '空间管理',
      component: SpaceManagePage,
      meta:{
        access: ACCESS_ENUM.ADMIN,
        icon: CloudOutlined
      }
    },
    {
      path: '/addSpace',
      name: '创建空间',
      component: AddSpacePage,
      props: true,
      meta:{
        access: ACCESS_ENUM.USER,
        icon: CloudServerOutlined
      }
    },
    {
      path: '/mySpace',
      name: '我的空间',
      component: MySpacePage,
      meta:{
        access: ACCESS_ENUM.USER,
        icon: FolderOpenOutlined
      }
    },
    {
      path: '/space/:id',
      name: '空间详情',
      component: SpaceDetailPage,
      props: true,
      meta:{
        hideInMenu: true
      }
    },

  ],

})



export default router
